<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
	.fixed-table-body{
		height: calc(73vh);
	}

	.fixed-table-footer{
		border-top: 0;
	}
</style>
<body class="gray-bg">
<div class="container-div">
	<div id="flexSearchBox"  class="collapse out col-sm-12 search-box">
		<form id="user-form">
			<input type="hidden" id="deptId" name="deptId">
			<input type="hidden" id="parentId" name="parentId">
			<div class="select-list">
				<ul>
					<li class="time">
						<label>upload date： </label>
						<input type="text" id="startTime" class="time-input reset"  placeholder="start date" name="beginCreateDate"/>
						<span>~</span>
						<input type="text" id="endTime" class="time-input reset"  placeholder="end date" name="endCreateDate"/>
					</li>
					<li>
						 file name：<input class="reset" type="text" name="fileName"/>
					</li>
					<li>
						<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;search</a>
						<a class="btn btn-primary btn-rounded btn-sm reset-booton"><i class="glyphicon glyphicon-repeat"></i>&nbsp;reset</a>
					</li>
				</ul>
			</div>
		</form>
	</div>

	<div class="btn-group hidden-xs" id="toolbar" role="group">
		<a class="btn btn-outline btn-success btn-rounded" onclick="uploadOrder()" shiro:hasPermission="module:ordersHead:add">
			<i class="fa fa-plus"></i> upload
		</a>
		<a class="btn btn-outline btn-info btn-rounded flex-botton" data-toggle="collapse" data-target="#flexSearchBox">
			<i class="glyphicon glyphicon-chevron-down">unfoldSearch
			</i>
		</a>
		<!--<a class="btn btn-outline btn-success" onclick="wxYanzhengma()">
			发送短信
		</a>-->
		<!--<a class="btn btn-outline btn-danger btn-info" onclick="$.operate.batRemove()" shiro:hasPermission="module:ordersHead:remove">
			<i class="fa fa-trash-o"></i> delete
		</a>-->
	</div>

	<div class="col-sm-12 select-info table-responsive">
		<table id="bootstrap-table" class="table text-nowrap" data-height="770" data-mobile-responsive="true"></table>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ruoyi/js/common.js}"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('module:ordersHead:edit')}]];
    var removeFlag = [[${@permission.hasPermi('module:ordersHead:remove')}]];
    var prefix = ctx + "module/ordersHead"

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/uploadOrder",
            //updateUrl: prefix + "/edit/{id}",
            //removeUrl: prefix + "/remove",
            modalName: "订单上传",
            showFooter:true,
            columns: [
                {
                    field : 'createDate',
                    title : 'upload date' ,
                    sortable: true,

                    footerFormatter: function (value) {
                        return 'total';
                    }
                },
                {
                    field : 'fileName',

                    title : '<span class="globalSearch_column">fileName</span>'
                },
                {
                    field : 'counts',
                    title : 'sum',
                    sortable: true,

                    footerFormatter: function (value) {
                        return calculateLineTotalAsServer(value,$.table.sumRows.counts);
                    }
                },

                {
                    field : 'bz',

                    title : 'remark'
                },
                {
                    field : 'companyName',

                    title : 'company'
                }
            ],
            onLoadSuccess: function (item, $element) {

                /*$.ajax({
                    url: '/orderHeadwebsocket',
                    dataType: 'json',
                    type: 'post',
                    success: function (data) {
                    }
                })*/

                $('.fixed-table-footer').addClass("totalRowBackground-color");
            },
        };
        $.table.init(options);
    });
</script>

<script>
    function uploadOrder(){
        var url = $.table._option.createUrl;
        $.modal.open("添加" + $.table._option.modalName, url);
    }

    $('body').on('click','.down',function () {
        var path = $(this).attr('data-text');
        form = $('<form></form>');
        form.attr('action','/module/ordersHead/down');
        form.attr('method','post');
        input = $("<input type='hidden' name='fileUrl' />")
        input.attr('value',path);
        form.append(input);
        form.appendTo("body")
        form.css('display','none')
        form.submit();
    });


function wxYanzhengma() {
    $.ajax({
        type: 'POST',
        url: prefix + "/wxYanzhengma",
        dataType: 'json'
    }).success(function(response) {
        console.log("success!");
    }).error(function(){  //ajax error
    });
}

</script>
</body>
</html>